home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_1049.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  997 b   |  8 lines

  1. Protected inheritance is similar to private inheritance; the answer is 'no'.
  2.     class Car : protected Engine {/*...*/};   //protected inheritance
  3.  
  4. In 'private' inheritance, only the class itself (and its friends) can know about the relation to the base class (the relationship to the base class is a 'private' decision).  In protected inheritance, the relationship with the base class is a 'protected' decision, so *subclasses* of the 'protectedly' derived class can also know about and exploit this relationship. 
  5.  
  6. This is a 'for better *and* for worse' situation: future changes to 'protected' decisions have further consequences than changing a private decision (in this case, the class, its friends, *and* subclasses, sub- sub- classes, etc, all need to be examined for dependencies upon the relationship to the base class). However it is also for better, in that subclasses have the ability to exploit the relationship.
  7.  
  8. The existence of protected inheritance in C++ is debated in some circles.